package localdatetime;

import java.time.LocalDateTime;

/**
 * Created by 5406160@qq.com on LiBoWen 李博闻.
 *
 * @ClassName : LocalDateTimeDemo1
 * @Author : 54061
 * @Date: 2022/2/11 21:26
 */
/*
get系列 ,plus系列,minus系列,with系列
 */
public class LocalDateTimeDemo1 {
    public static void main(String[] args) {

        LocalDateTime now = LocalDateTime.now();

        //获取时间信息
        System.out.println("now = " + now.getMinute());
        System.out.println("now.getMinute() = " + now.getMinute());

        //加时间 减时间
        LocalDateTime time = now.plusYears(-1);
        System.out.println("time = " + time);

        LocalDateTime time1 = time.minusMonths(-3);
        System.out.println("time1 = " + time1);
        //设置时间
        LocalDateTime localDateTime =  now.withMonth(8);
        System.out.println("localDateTime = " + localDateTime);
    }
}
